package models

import (
	"time"
)

type Topic struct {
	ID            uint      `gorm:"primarykey" json:"id"`
	Name          string    `gorm:"size:50;not null;unique" json:"name"`
	Introduction  string    `gorm:"type:text" json:"introduction,omitempty"`
	Avatar        string    `json:"avatar,omitempty"`
	FollowerCount int       `gorm:"default:0" json:"followerCount"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`

	// 关联
	Followers []*User     `gorm:"many2many:user_following_topics" json:"followers,omitempty"`
	Questions []*Question `gorm:"many2many:question_topics" json:"questions,omitempty"`
}
